﻿@using Backend.JYD.Business
@using Backend.JYD.Model
@{
    var currMenu = this.ViewBag.CurrMenu as string;
     var loginEmpInfo = this.ViewBag.LoginEmpInfo as EmpInfo;
     if(loginEmpInfo != null)
     {
     var menuInfos = new MenuManager().GetEmpMenuInfoesByEmpId(loginEmpInfo.EmpId);
     if(menuInfos != null)
     {
         var parents = menuInfos.FindAll(p => p.Level == 1);
         foreach (var info in parents)
         {
    <h1 class="side-tit"><a href="javascript:void(0)">@info.Name</a></h1>
             var children = menuInfos.FindAll(p => p.Level > 1 && p.MenuId.StartsWith(info.MenuId));
             //目前只有两级目录。写死了。
    <div class="content">
        <ul class="side-cnt">
            @foreach (var child in children)
            {
            <li id="@("mu"+child.MenuId)" curr="@(currMenu == "mu" + child.MenuId ? "true" : "false")"><a href="@child.Url" target="_top">@child.Name</a></li>
            }
        </ul>
    </div>
         }
         }
     }
}
<script type="text/javascript">
    $(document).ready(function () {
        $(".content .side-cnt li[id^='mu']").each(function () {
            if ($(this).attr("id") == '@currMenu') {
                $(this).addClass("active");
                showCurrMenu($(this).parent().parent());
            }
        });
    });
</script>
